Skip to content

feat(tool): add middle truncation to preserve recent content#3

Closed
membranch[bot] wants to merge 1 commit into
devfrom
membranch/cx-3760-cut-down-fetch-issue-tool-results-to-prioritize-recent-64f4a0fd
Closed

feat(tool): add middle truncation to preserve recent content#3
membranch[bot] wants to merge 1 commit into
devfrom
membranch/cx-3760-cut-down-fetch-issue-tool-results-to-prioritize-recent-64f4a0fd

Conversation

@membranch
Copy link
Copy Markdown

@membranch membranch Bot commented Mar 6, 2026

Summary

  • Adds a "middle" truncation direction that keeps both the beginning (~30%) and end (~70%) of tool output, removing the middle
  • Changes the default truncation direction from "head" to "middle" so recent content (e.g. latest Slack thread replies, recent errors) is preserved alongside initial context (issue metadata, headers)
  • Existing "head" and "tail" directions remain available for explicit use

Problem: Long Slack/issue threads in the CX intake flow caused the fetch-issue tool result to be truncated from the end, losing the most recent and relevant messages (e.g., recent errors). The previous "head" default kept only the beginning of the output.

Fix: The 70/30 tail-biased middle truncation ensures both the initial context and recent messages are preserved when output exceeds the 50KB/2000-line limit.

Closes CX-3760

Test plan

  • All 15 existing + new truncation tests pass
  • Typecheck passes across all packages
  • Verify with a long Slack thread issue that recent messages are now visible in the truncated output

🤖 Generated with Claude Code

When tool output exceeds size limits, truncation now defaults to
"middle" mode which keeps both the beginning (~30%) and end (~70%)
of the output, removing the middle. This ensures recent messages
(e.g. latest Slack thread replies, recent errors) are preserved
alongside initial context (issue metadata, headers).

Previously the default "head" truncation kept only the beginning,
causing the most relevant recent content to be lost for long
Slack/issue threads in the CX intake flow.

Closes CX-3760

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@linear
Copy link
Copy Markdown

linear Bot commented Mar 6, 2026

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 6, 2026

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@membranch membranch Bot requested a review from kynnyhsap March 6, 2026 12:02
@membranch membranch Bot closed this Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant